[PATCH 1/2] lib/pty: Put master PTY into non-blocking mode and buffer its output...
authorнаб <nabijaczleweli@nabijaczleweli.xyz>
Tue, 12 Apr 2022 14:25:14 +0000 (16:25 +0200)
committerChris Hofstaedtler <zeha@debian.org>
Mon, 13 Feb 2023 08:48:21 +0000 (08:48 +0000)
commitf5448941bb8f1292a3530c33e0c0c24ced2115c4
tree6fc137b2e64cc739963c640fba48467b7c1b78cc
parente6204e9e2d1f0286284b1e8cb5809cad26ff5b4b
[PATCH 1/2] lib/pty: Put master PTY into non-blocking mode and buffer its output to avoid deadlock

If we filled the script->child buffer before the child had a chance to read any
input, we'd sleep forever in write_all(pty->master), and the child would sleep
forever in write(1<pty->slave>)

By putting the master PTY in non-blocking mode, we can poll(pty->master,
POLLOUT) and keep supplying more data as the child reads from the buffer

Fixes Debian bug #1003095

Signed-off-by: Karel Zak <kzak@redhat.com>
Gbp-Pq: Topic upstream
Gbp-Pq: Name PATCH-1-2-lib-pty-Put-master-PTY-into-non-blocking-mode-a.patch
include/pty-session.h
lib/pty-session.c